package com.xxl.job.executor.entity;

import java.util.List;

/**
 * @author wenhonghao
 * @email 18167784149@163.com
 * @description: 用于执行器传递执行结果
 */
public class JobResultDTO {
    private String serverIp;  // 执行器IP
    private Boolean success;  // 执行是否成功
    private String message;   // 错误消息或结果描述
    private String user; // 服务器用户
    private List<CronTaskResult> cronTasks;  // 包含多个定时任务结果的列表

    @Override
    public String toString() {
        return "JobResultDTO{" +
                "serverIp='" + serverIp + '\'' +
                ", success=" + success +
                ", message='" + message + '\'' +
                ", user='" + user + '\'' +
                ", cronTasks=" + cronTasks +
                '}';
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getServerIp() {
        return serverIp;
    }

    public void setServerIp(String serverIp) {
        this.serverIp = serverIp;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public List<CronTaskResult> getCronTasks() {
        return cronTasks;
    }

    public void setCronTasks(List<CronTaskResult> cronTasks) {
        this.cronTasks = cronTasks;
    }

    public static class CronTaskResult {
        @Override
        public String toString() {
            return "CronTaskResult{" +
                    "schedule='" + schedule + '\'' +
                    ", command='" + command + '\'' +
                    '}';
        }

        private String schedule;  // 调度时间
        private String command;   // 执行的命令

        public String getSchedule() {
            return schedule;
        }

        public void setSchedule(String schedule) {
            this.schedule = schedule;
        }

        public String getCommand() {
            return command;
        }

        public void setCommand(String command) {
            this.command = command;
        }
    }
}
